package io.zhaocy.springbootenable.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * Description:
 *
 * @Author: genezhao
 * @Date: 2018-07-13
 */
@What(description = "An annotation test class")
@MyAnno(str="test2", val = 10)
public class MyAnnoTest2 {

    @What(description = "An annotation test method")
    @MyAnno(str="testing", val = 100)
    public static void myMeth() {

        MyAnnoTest2 mat2 = new MyAnnoTest2();

        Annotation annos[] = mat2.getClass().getAnnotations();

        for (Annotation a : annos) {
            System.out.println(a);
        }

        System.out.println();

        try {
            Method m = mat2.getClass().getMethod("myMeth");
            annos = m.getAnnotations();

            for (Annotation a : annos) {
                System.out.println(a);
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        myMeth();
    }
}
